#include "commun.h"

using namespace std;

Tcardinality getCardinalityFromString(string s)
{
	if (s == "+")
	{
		return CARD_PLUS;
	}
	else if (s == "?")
	{
		return CARD_QMARK;
	}
	else if (s == "*")
	{
		return CARD_STAR;
	}
	else
	{
		return CARD_NONE;
	}
}

string getStringFromCardinality(Tcardinality card)
{
	if (card == CARD_PLUS)
	{
		return string("+");
	}
	else if (card == CARD_QMARK)
	{
		return string("?");
	}
	else if (card == CARD_STAR)
	{
		return string("*");
	}
	else
	{
		return string("");
	}
}

type getTypeFromString(string s)
{
	if (s == "|")
	{
		return TYPE_PIPE;
	}
	else if (s == ",")
	{
		return TYPE_COMMA;
	}
	else
	{
		return TYPE_NONE;
	}
}

string getStringFromType(type t)
{
	if (t == TYPE_PIPE)
	{
		return string("|");
	}
	else if (t == TYPE_COMMA)
	{
		return string(",");
	}
	else
	{
		return string("");
	}
}
